import com.top.entiy.User;
import com.top.service.CommonService;
import com.top.service.UserService;

import java.sql.SQLException;
import java.util.Scanner;

/**
 * @Author:
 * @DateTime: 2023/12/7 16:55
 * @Description: TODO
 */
public class AdminMain {
    private CommonService commonService = new CommonService();
    private UserService userService = new UserService();

    public static void main(String[] args) throws SQLException {
        AdminMain main = new AdminMain();
        main.adminView();
    }

    private void adminView() {
        Scanner scanner = new Scanner(System.in);
        while (true) {
            System.out.println("------------登录----------");
            System.out.println("请输入用户名：");
            String name = scanner.next();
            System.out.println("请输入密码：");
            String pwd = scanner.next();
            User user = new User();
            user.setUsername(name);
            user.setPassword(pwd);
            boolean b = userService.doLogin(user);
            if (b) {
                System.out.println("登录成功");
                commonService.index();
            } else {
                System.out.println("登录失败");
            }
        }
    }

}



